Adding some more judges, here and there.
[andmenj-acm.git] / E-Olimp / 2130 - The angle between the vectors / 2130.cpp
blobf9a4c39e3c4e68bf76eda5ccff6de1374109dc4e
1 using namespace std;
2 #include <algorithm>
3 #include <iostream>
4 #include <iterator>
5 #include <numeric>
6 #include <sstream>
7 #include <fstream>
8 #include <cassert>
9 #include <climits>
10 #include <cstdlib>
11 #include <cstring>
12 #include <string>
13 #include <cstdio>
14 #include <vector>
15 #include <cmath>
16 #include <queue>
17 #include <deque>
18 #include <stack>
19 #include <list>
20 #include <map>
21 #include <set>
23 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
24 #define For(i, a, b) for (int i=(a); i<(b); ++i)
25 #define D(x) cout << #x " is " << x << endl
27 const double pi = 2 * acos(0.0);
29 int main(){
30 // for (int i = 0; i < 1000; ++i){
31 // int n = 10;
32 // while (true) {
33 // int a = rand() % n, b = rand() % n, c = rand() % n, d = rand() % n;
34 // if (rand() % 2) a = -a;
35 // if (rand() % 2) b = -b;
36 // if (rand() % 2) c = -c;
37 // if (rand() % 2) d = -d;
38 //
39 // if (a == 0 and b == 0 or c == 0 and d == 0) continue;
40 // printf("%d %d %d %d\n", a, b, c, d);
41 // break;
42 // }
43 // }
45 double ax, ay, bx, by;
46 while (cin >> ax >> ay >> bx >> by) {
47 double k = (ax * bx + ay * by) / (hypot(ax, ay) * hypot(bx, by) );
48 if (k < -1.0) k = -1.0;
49 if (k > 1.0) k = 1.0;
50 double ans = acos( k );
51 //ans = floor(100000.0 * ans + 0.5) / 100000.0;
52 //cout << ax << " " << ay << " " << bx << " " << by << endl;
53 //assert(ans >= 0);
54 assert(ans == ans);
55 printf("%.5lf\n", fabs(ans));
57 return 0;